package com.dsteiner.widgets.client.rpc;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import com.dsteiner.widgets.client.SuggestBoxWidget.SuggestionRequest;
import com.dsteiner.widgets.client.SuggestBoxWidget.SuggestionResult;
import com.dsteiner.widgets.client.domain.Distinct;
import com.dsteiner.widgets.client.domain.ModelObject;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;

/**
 * The client side stub for the RPC service.
 */
public interface BaseDataService extends RemoteService {
	public static class Util {
		private static BaseDataServiceAsync instance;
		public static BaseDataServiceAsync getInstance(){
			if (instance == null) {
				instance = (BaseDataServiceAsync) GWT.create(BaseDataService.class);
			}
			return instance;
		}
	}

	<T extends ModelObject> SearchResult<T> search(SearchRequest searchRequest);
	
	CrudResult createModelObject(ModelObject modelObject);
	
	CrudResult getObjectById(String id, String objectClassName);

	CrudResult deleteObject(ModelObject modelObject);

	CrudResult updateObject(ModelObject modelObject);

	SuggestionResult getSuggestions(SuggestionRequest request);
}
